﻿/**
* Vista asociada el listado 
* de las regiones
* en el aplicativo.
*/
Ext.define("entgpv11.view.ContentMenu02.RegionesListContainer", {
    extend: "Ext.Container",
    alias: "widget.regioneslistcontainer",
	requires: [
       	'entgpv11.view.ContentMenu02.RegionesCharts'
    ],
	config: {
	    layout: {
            type: 'fit'
        }
    },
	initialize: function () {
	    try
        {
                this.callParent(arguments);
		        var lblInfo ={
		            docked: 'top',
                    height: 80,
			        xtype: 'fieldset',
			        title: 'Regiones',
			        instructions: 'Selecione un item'
		        };
		        var storeRegionList = Ext.getStore('Region');
	            //Apply the params
		        //APP_GLOBAL.SetProxyExtraParams(storeRegionList,this.getDataArguments());
		        //Reload your store
		        storeRegionList.load();
                var regionList = {
                    xtype: "list",
			        height: "95%",
			        loadingText:"Cargando datos...",
			        itemTpl: "<div>{region}</div>",
			        grouped: false,
			        onItemDisclosure: true,
                    store: storeRegionList,
			        listeners: {
                         disclose: { fn: this.onRegionListDisclose, scope: this }
                    }
                };
                /*
                this.add([{ xtype: "fieldset",
                        items: [lblInfo,regionList]
                    }]);
	            */
		
	           var backendViewport = new Ext.Panel({
                layout: 'fit',
                border: false,
                items: [lblInfo,regionList]
        
		        });

		         this.add(backendViewport);
		     } catch (ex) {
                 APP_GLOBAL.SetLog('RegionesListContainer.initialize::' + ex);
             }
			 
    },
	onRegionListDisclose: function (list, record, target, index, evt, options) {
        //console.log("onRegionListDisclose");
        this.fireEvent('editRegionesCommand', this, record);
    }
   
});